

#include "TestCheckWithdrawMoney.h"
#include "AccountBussiness.h"

CPPUNIT_TEST_SUITE_REGISTRATION(TestCheckWithdrawMoney);

TestCheckWithdrawMoney::TestCheckWithdrawMoney(void)
{
}

TestCheckWithdrawMoney::~TestCheckWithdrawMoney(void)
{
}

void TestCheckWithdrawMoney::TestCheckWithdrawMoney_InputAmountWithBalance_ReturnTrue() 
{
        long lAmount = 500000;
		long lAmount2 = 40500000;

        long lBalance = 5000000;
		long lBalance2 = 200000;

        bool bActualResult;

        AccountBussiness objAccBussiness;

		// =================== Check Balance =========================
        bActualResult = objAccBussiness.CheckBalance(lAmount, lBalance);
        bool bExpectedResult = true;
        CPPUNIT_ASSERT_EQUAL(bActualResult, bExpectedResult);

		bool bExpectedResult2 = false;
        bActualResult = objAccBussiness.CheckBalance(lAmount, lBalance2);
        CPPUNIT_ASSERT_EQUAL(bActualResult, bExpectedResult2);

		// ====================== CheckMoneyATM ===========================
		long lATMMoney = 39500000;
        bool bExpectedResult3 = true;
		bActualResult = objAccBussiness.CheckMoneyATM(lAmount, lATMMoney);
		CPPUNIT_ASSERT_EQUAL(bActualResult, bExpectedResult3);

		bool bExpectedResult4 = false;
		bActualResult = objAccBussiness.CheckMoneyATM(lAmount2, lATMMoney);
		CPPUNIT_ASSERT_EQUAL(bActualResult, bExpectedResult4);

		// ========================== CheckDailyWithdraw ===================
		char sAccountID[] = "00000000001";
		bool bExpectedResult5 = true;
		bActualResult = objAccBussiness.CheckDailyWithdraw(sAccountID);
		CPPUNIT_ASSERT_EQUAL(bActualResult, bExpectedResult5);

        // sua lai ngay he thong cua AccountID = 00000000005
        char sAccountID2[] = "00000000005";
		bool bExpectedResult6 = false;
		bActualResult = objAccBussiness.CheckDailyWithdraw(sAccountID2);
		CPPUNIT_ASSERT_EQUAL(bActualResult, bExpectedResult6);
		
		// ======================== CheckAmount ============================
		long MAX_AMOUNT = 5000000;
		bool bExpectedResult7 = true;
		bActualResult = objAccBussiness.CheckAmount(lAmount, MAX_AMOUNT);
		CPPUNIT_ASSERT_EQUAL(bActualResult, bExpectedResult7);
		
		bool bExpectedResult8 = false;
		bActualResult = objAccBussiness.CheckAmount(lAmount2, MAX_AMOUNT);
		CPPUNIT_ASSERT_EQUAL(bActualResult, bExpectedResult8);
}
	
